package xgenerator.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Properties;

public class PropertiesUtils {
	
	public static Properties getProperties(String propertiesFile) {
		return getProperties(new File(propertiesFile));
	}
	
	public static Properties getProperties(File propertiesFile) {
		try {
			return getProperties(new FileInputStream(propertiesFile));
		} catch (FileNotFoundException e) {
			throw new RuntimeException(e);
		}
	}
	
	public static Properties getProperties(InputStream inputStream) {
		return getProperties(new InputStreamReader(inputStream));
	}
	
	public static Properties getProperties(Reader reader) {
		Properties properties = new Properties();
		try {
			properties.load(reader);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return properties;
	}

}
